// SortUtils.cpp

#include "StdAfx.h"

#include "SortUtils.h"
#include "Common/FileSystem/Wildcard.h"

#include <algorithm>

namespace Common
{
namespace FileSystem
{
static int CompareStrings(const int *p1, const int *p2, void *param)
{
  const CStringVector &strings = *(const CStringVector *)param;
  return Common::FileSystem::CompareFileNames(strings[*p1], strings[*p2]);
}

bool CompareStringsFunct(CString &p1, CString  &p2)
{
  return 0 > Common::FileSystem::CompareFileNames(p1, p2);
}

void SortFileNames(std::vector<CString> &strings)
{
	std::sort(strings.begin(), strings.end(), CompareStringsFunct);
}

/*void SortFileNames(const CStringVector &strings, CIntVector &indices)
{
  indices.Clear();
  size_t numItems = strings.size();
  indices.Reserve(numItems);
  for(int i = 0; i < numItems; i++)
    indices.Add(i);
  indices.Sort(CompareStrings, (void *)&strings);
}*/

}
}